package org.example.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.example.domain.Goods;

import java.util.List;

@Mapper
public interface GoodsDao extends BaseMapper<Goods> {
    @Insert("insert into goods_info (goods_id,information) values (#{goodsId},#{information})")
    int infoInsert(int goodsId,String information);
//    @Delete("delete from goods_info where goods_id=#{goodsId}")
    @Update("update goods_info set deleted = 1 where goods_id=#{goodsId}")
    int deleteInfoByGoodsId(Integer goodsId);
    @Select("select information from goods_info where goods_id=#{goodsId}")
    String selectInfoByGoodsId(Integer goodsId);
    @Select("select type from goods where id = #{goodsId}")
    List<String> getTypeByGoodsId(int goodsId);
    @Select("SELECT DISTINCT id FROM goods WHERE NAME LIKE #{name}")
    List<Integer> getGoodsIdByType(@Param("type") String name);
    @Select("select goods_name from goods where id = #{id}")
    String getGoodsNameById(int id);

}
